package model;

public class Spy{
    
	private final Troop troop;
	private final Player owner;
	private Territory territory;
	private int probability;
	
	public Spy(Player owner, Troop troop, Territory territory){
		this.troop = troop;
		this.territory  = territory;
		this.owner = owner;
		probability = 0;
	}
	
	public Troop covertBack(){return troop;}
	
	public Territory getTerritory(){return territory;}
	public void setTerritory(Territory t){
		if (t.getOwner() != owner) {
			if (t.getOwner() != territory.getOwner()/*|| t.getOwner() = default vacant */)
				probability = 0;
			else
				probability += 7;
		}
		if (t.getOwner() == owner)
			probability = 0;
    
		territory = t;
	}
	
	public int getProbability(){return probability;}
	
	public TechnologyLevel getLevel(){return troop.getLevel();}
	
	public Player getOwner(){return owner;} 
	public boolean getActioned(){return troop.getActioned();}
	public void setActioned(boolean b){troop.setActioned(b);}
}
